#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main() {
	int fd = open("log.txt",O_CREAT|O_RDWR,0666);
	if (fd < 0) {return 1;}
	dup2(fd,1);
	dup2(fd,2);
	printf("%s","验证stdout有缓冲区");
	sleep(5);
	char buffer[1024] = "验证stderr没有缓冲区";
	fprintf(stderr,"%s",buffer);
	sleep(5);
	return 0;
}
